package project.test;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class ChatClient {
    public static void main(String[] args)throws IOException {

        Socket s = new Socket("localhost", 9999);
        InputStream in = s.getInputStream();
        OutputStream out = s.getOutputStream();
        PrintWriter pw=new PrintWriter(out,true);
        BufferedReader br=new BufferedReader(new InputStreamReader(in));
        String str=null;
        Scanner input = new Scanner(System.in);
        while (true){
            str=br.readLine();
            System.out.println(str);
            pw.println(input.nextLine());//刷新  行
            //pw.println(input.nextLine());
            //pw.println("hello");
        }
    }
}
